<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="com.src.computec.radar.reclamos.source.ReclamosSource"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>File Upload Gateway</title>
        <link rel="stylesheet" href="resources/stylesheet.css" type="text/css">
        <link rel="stylesheet" type="text/css" href="http://portaldocumentos.computec.com.co:8080/RECLAMOSWebApplicationFileUpload/theme/com/sun/rave/web/ui/defaulttheme/css/css_master.css" />
    </head>
    <body>
    <%
        String ldapUser = request.getParameter("ldapUser");
        String passwordVerification = request.getParameter("passwordVerification");
        String result = request.getParameter("result");
        if (ldapUser != null && !ldapUser.equals("") && passwordVerification != null && passwordVerification.equals(ReclamosSource.getInstance().getReclamosSetupKey("passwordVerification"))) {
    %>
    <form name="fileUploadGatewayForm" action="ServletFileUploadGateway" method="post" enctype="multipart/form-data">
        <table>
            <tr>
                <td align="center">
                    <table id="fileUploadGatewayGridPanel" style="text-align: center" width="100%">
                        <tbody>
                            <tr>
                                <td><input type="file" name="fileUploadGateway" size="40"/></td>
                                <td><input type="submit" value="CARGAR" class="button"/></td>
                            </tr>
                        </tbody>
                    </table>
                    <table id="espaciadorGridPanel" style="text-align: center" width="100%">
                        <tbody>
                            <tr>
                                <td><span id="outputText" style="color: white">___________________________________________________________</span></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>
    </form>
    <%
        }
        else if (result != null && result.equals("1")) {
    %>
    <!-- mensajeAlert -->
    <table id="mensajeAlertGridPanel" style="text-align: center" width="100%">
        <tbody>
            <tr>
                <td>
                    <div id="mensajeAlert">
                        <table border="0" cellspacing="0" cellpadding="0" title="" class="AlrtTbl">
                            <tr>
                                <td valign="middle"><div class="AlrtInfTxt"><img id="mensajeAlert_alertImage" src="http://portaldocumentos.computec.com.co:8080/RECLAMOSWebApplicationFileUpload/theme/com/sun/rave/web/ui/defaulttheme/images/alerts/success_large.gif" height="21" width="21" border="0"/>Exito</div><div class="AlrtMsgTxt">El archivo ha sido cargado adecuadamente</div></td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <form name="fileUploadGatewayForm">
        <input type="hidden" name="nameUploadedFile">
    </form>
    <%
            out.println("<script language=\"JavaScript\">");
            out.println("document.fileUploadGatewayForm.nameUploadedFile.value = '" + request.getParameter("nameUploadedFile") + "';");
            out.println("</script>");
    %>
    <!-- javascript -->
    <script language="JavaScript" type="text/javascript">
        if (document.forms["fileUploadGatewayForm"]["nameUploadedFile"].value != "") {
            opener.document.forms["accionesForm"]["accionesForm:nameFileAttachTextField"].value = document.forms["fileUploadGatewayForm"]["nameUploadedFile"].value;
            opener.document.forms["accionesForm"]["accionesForm:nameFileAttachHiddenField"].value = document.forms["fileUploadGatewayForm"]["nameUploadedFile"].value;
            setTimeout("closePopupFileUpload()", 3000);
        }
    </script>
    <%
        }
        else if (result != null && result.equals("2")) {
    %>
    <!-- mensajeAlert -->
    <table id="mensajeAlertGridPanel" style="text-align: center" width="100%">
        <tbody>
            <tr>
                <td>
                    <div id="mensajeAlert">
                        <table border="0" cellspacing="0" cellpadding="0" title="" class="AlrtTbl">
                            <tr>
                                <td valign="middle"><div class="AlrtInfTxt"><img id="mensajeAlert_alertImage" src="http://portaldocumentos.computec.com.co:8080/RECLAMOSWebApplicationFileUpload/theme/com/sun/rave/web/ui/defaulttheme/images/alerts/error_large.gif" height="21" width="21" border="0"/>Exito</div><div class="AlrtMsgTxt">El archivo excede el m&aacute;ximo tama&ntilde;o permitido para ser cargado al sistema</div></td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- javascript -->
    <script language="JavaScript" type="text/javascript">
        setTimeout("closePopupFileUpload()", 4000);
    </script>
    <%
        }
        else if (result != null && result.equals("3")) {
    %>
    <!-- mensajeAlert -->
    <table id="mensajeAlertGridPanel" style="text-align: center" width="100%">
        <tbody>
            <tr>
                <td>
                    <div id="mensajeAlert">
                        <table border="0" cellspacing="0" cellpadding="0" title="" class="AlrtTbl">
                            <tr>
                                <td valign="middle"><div class="AlrtInfTxt"><img id="mensajeAlert_alertImage" src="http://portaldocumentos.computec.com.co:8080/RECLAMOSWebApplicationFileUpload/theme/com/sun/rave/web/ui/defaulttheme/images/alerts/error_large.gif" height="21" width="21" border="0"/>Exito</div><div class="AlrtMsgTxt">El archivo que esta intentando subir al sistema es inv&aacute;lido</div></td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- javascript -->
    <script language="JavaScript" type="text/javascript">
        setTimeout("closePopupFileUpload()", 4000);
    </script>
    <%
        }
        else {
    %>
    <!-- mensajeAlert -->
    <table id="mensajeAlertGridPanel" style="text-align: center" width="100%">
        <tbody>
            <tr>
                <td>
                    <div id="mensajeAlert">
                        <table border="0" cellspacing="0" cellpadding="0" title="" class="AlrtTbl">
                            <tr>
                                <td valign="middle"><div class="AlrtInfTxt"><img id="mensajeAlert_alertImage" src="http://portaldocumentos.computec.com.co:8080/RECLAMOSWebApplicationFileUpload/theme/com/sun/rave/web/ui/defaulttheme/images/alerts/info_large.gif" height="21" width="21" border="0"/>Informaci&oacute;n</div><div class="AlrtMsgTxt">Es imposible el acceso a esta aplicaci&oacute;n</div></td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- javascript -->
    <script language="JavaScript" type="text/javascript">
        setTimeout("closePopupFileUpload()", 4000);
    </script>
    <%
        }
    %>
    <!-- javascript -->
    <script language="JavaScript" type="text/javascript">
        function closePopupFileUpload() {
            window.close();
        }
    </script>
    </body>
</html>